const state = {
    userInfo: {
        userId: '',
        userName: '',
        password: '',
        bankcard: null,
    }
}

const getters = {
    userId: state => {
        return state.userInfo.userId;
    },
    userName: state => {
        return state.userInfo.userName;
    },
    password: state => {
        return state.userInfo.password;
    },
    bankcard: state => {
        return state.userInfo.bankcard;
    },
}

const mutations = {
    saveUserState(state, userInfo) {
        state.userInfo.userId = userInfo.userId;
        state.userInfo.userName = userInfo.userName;
        state.userInfo.password = userInfo.password;
        state.userInfo.bankcard = userInfo.bankcard;
    },
    clearUserState(state) {
        state.userInfo.userId = '';
        state.userInfo.userName = '';
        state.userInfo.password = '';
        state.userInfo.bankcard = null;
    }
}



export default {
    namespaced: true,
    state,
    getters,
    mutations
}
  